const model  = require('../model/model');
const basedao=require('../basedao')
const mongoose = require('mongoose');


/* 添加知识点 */
async function  daoaddpoint(data){
	
	  	 let dd=new model.modelpoint(data)
		 return	dd.save()
}


/* 查询知识点 */



/* 知识点-题目中间表 */
/* 添加 */


async function  daoaddpointTittle(data){
	
	let xx=new model.modelpointTittle(data)
  return	xx.save()
}


class point extends basedao.basedao{


	findKemuIncludePoint(id){
	
		  return new Promise((res,rej)=>{
		
			    this.model.aggregate(
			        [
			             {$match: {'kemuid':mongoose.Types.ObjectId(id) }}
			        ]  
			     ,(err,docs)=>{
			
			         if(err){res(err)}else if(docs){res(docs)}
			    })
			  })  
		}	

	

	

}

	





	





module.exports={
	daoaddpoint,daoaddpointTittle,point
}
